﻿@inject NavigationManager NavigationManager
@inject IDataCacheService _dataCacheService

<CnGalWebSite.Components.Containers.MasaTitleContainer Title="手机号" Icon="fa fa-fw fa-mobile-phone" Class="h-100">
    <div style="display: flex; flex-direction: column; justify-content: space-between;">
        <span>@(string.IsNullOrWhiteSpace(Model.Phone)? "绑定手机号可以提供账户安全性" : ("手机号："+ Model.Phone))</span>

        <div style="display: flex; justify-content: flex-end;">
            <div>
                <MButton Text Block  OnClick="OnClick" Color="primary">
                    <MIcon Left>@(string.IsNullOrWhiteSpace(Model.Phone)? "mdi-link-variant" : "mdi-link-variant-plus ")</MIcon>
                    @(string.IsNullOrWhiteSpace(Model.Phone)? "绑定" : "更换绑定")
                </MButton>
            </div>

        </div>
    </div>
</CnGalWebSite.Components.Containers.MasaTitleContainer>

@code {

    [Parameter]
    public EditUserDataViewModel Model { get; set; } = new EditUserDataViewModel();

    public void OnClick()
    {
        @if (string.IsNullOrWhiteSpace(Model.Phone))
        {
            NavigationManager.NavigateTo("/account/AddPhoneNumber/" + ToolHelper.Base64EncodeUrl(NavigationManager.Uri));
        }
        else
        {
            NavigationManager.NavigateTo("/account/ChangePhoneNumber/" + ToolHelper.Base64EncodeUrl(NavigationManager.Uri));

        }
        
    }
}
